<template>
  <div class="rightListBox">
    <section>
      <div class="r1-head">
        <img
        src="../../assets/img/bgImg/plant10.png"
        alt=""
        />
      </div>
    </section>
    <section class="rs4">
      <h2 class="ui label">热门文章</h2>
      <ul>
        <li v-for="(item, index) in browseList" :key="'browseList' + item.id">
          <a :href="'#/BaikeDetailPage?aid=' + item.id" target="_blank">{{
              item.title
            }}</a>
          —— {{ item.viewCount }} 次围观
        </li>
      </ul>
    </section>

  </div>
</template>

<script>
import {historyArticleList, hotArticleList} from "@/api/article";

export default {
  name: "RightList",
  data() {
    //选项 / 数据
    return {
      fixDo: false,
      loveMe: false,
      browseList: "", //热门文章 浏览量最多
      artCommentList: "", //最新评论
    };
  },
  methods: {
    //事件处理器
    getHotArticleList() {
      hotArticleList().then(res =>{
        console.log(res)
        this.browseList=res
      })
    },
  },
  components: {
    //定义组件
  },

  created() {
    this.getHotArticleList();
    // //生命周期函数
    // var that = this;
    // window.onscroll = function () {
    //   var t = document.documentElement.scrollTop || document.body.scrollTop;
    //   // console.log(t);
    //   if (!that.going) {
    //     if (t > 600) {
    //       that.gotoTop = true;
    //     } else {
    //       that.gotoTop = false;
    //     }
    //   }
    //   if (t > 1200) {
    //     that.fixDo = true;
    //   } else {
    //     that.fixDo = false;
    //   }
    // };
    //查询浏览量最多的10篇文章数据


  },
}
</script>

<style lang="less">
.rightListBox {
  position: relative;
}
.rightListBox section {
  transition: all 0.2s linear;
  position: relative;
  background: #fff;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 5px;
  right: 50px;
  top: 23px;
  bottom: 0px;
}
.rightListBox section:hover {
  transform: translate(0, -2px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}
.rightListBox .r1-head {
  text-align: center;
  border-radius: 4px 4px 0 0;
  text-align: center;
  position: relative;
  /*box-shadow: inset 0 -70px 100px -50px rgba(0,0,0,.5);*/
}
.rightListBox .r1-head img {
  width: 100%;
  min-height: 100px;
}
.rightListBox .r1-head h1 {
  position: absolute;
  bottom: 5px;
  margin: 0 0 0 -65px;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
  font-weight: 700;
  width: 130px;
  left: 50%;
}
.rightListBox .r1-head h1 span {
  opacity: 0.3;
}
.rightListBox .r1-body p {
  font-size: 14px;
  margin: 5px 0 8px 0;
  font-weight: 700;
  text-align: center;
}
.rightListBox .r1-body .catch-me {
  text-align: center;
}
.rightListBox .r1-body .catch-me a {
  display: inline-block;
  margin-bottom: 7px;
  position: relative;
  text-decoration: none;
}
.rightListBox .r1-body .catch-me a:hover i {
  color: #fff;
  background: #f4692c;
}
.rightListBox .r1-body .catch-me a i {
  display: inline-block;
  font-size: 18px;
  width: 42px;
  height: 42px;
  line-height: 42px;
  border-radius: 42px;
  color: rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease-in-out;
  font-style: normal;
  margin: 0 3.2px;
}
/************排队看这些***************/
.rs4{
  padding: 0;
  margin-bottom: 20px;
}
.rightListBox .rs4 li {
  padding: 8px 0;
  text-align: justify;
}
.rightListBox .rs4 li a {
  font-weight: 600;
}
.rightListBox .rs4 li a:hover {
  color: #64609e;
}

/*回到顶部*/
/*返回到顶部*/
//.toTop {
//  position: fixed;
//  right: 40px;
//  top: -150px;
//  z-index: 99;
//  width: 70px;
//  height: 900px;
//  transition: all 0.5s 0.3s ease-in-out;
//  cursor: pointer;
//}
//.goTop {
//  top: -950px;
//}
//.toTop img,
//.toTophui img {
//  width: 100%;
//  height: auto;
//}
//.toTophui {
//  position: fixed;
//  right: 10px;
//  bottom: 80px;
//  z-index: 99;
//  width: 120px;
//  height: 120px;
//  transition: all 0.5s 0.3s ease-in-out;
//  cursor: pointer;
//  animation: toflow 2s ease-in-out infinite;
//}
//@keyframes toflow {
//  0% {
//    /*top:400px;*/
//    transform: scale(0.95) translate(0, 10px);
//  }
//  50% {
//    /*top:410px;*/
//    transform: scale(1) translate(0, 0px);
//  }
//  100% {
//    /*top:400px;*/
//    transform: scale(0.95) translate(0, 10px);
//  }
//}
//.goTophui {
//  bottom: 120vh;
//}
</style>
